import localStorageService from 'store/localStorageService.js'

const state = {
  nowUser: localStorageService.getNowUser()
}

const getters = {
  nowUser: state => state.nowUser
}

const actions = {
  setNowUser({ commit }, nowUser) {
    commit('setNowUser', nowUser)
  }
}

const mutations = {
  setNowUser(state, nowUser) {
    state.nowUser = nowUser
    localStorageService.setNowUser(nowUser)
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
